$OpenBSD: patch-src_amuled_cpp,v 1.1 2016/11/23 09:56:21 dcoppa Exp $

commit 5cf7ef9a7dcff2776d9ebc8bb8337e7e3203e6ab
Author: upstream svn <svn@amule.org>
Date:   Mon Nov 21 11:10:27 2016 +0000

Add a routine to set file name conversion for amuled, which is based
on wxAppConsole: fix sharing directories with non-ASCII names with
aMule daemon.

--- src/amuled.cpp.orig	Fri Sep 16 09:55:07 2016
+++ src/amuled.cpp	Wed Nov 23 09:06:27 2016
@@ -704,6 +704,41 @@ int CamuleDaemonApp::InitGui(bool ,wxString &)
 	return 0;
 }
 
+bool CamuleDaemonApp::Initialize(int& argc_, wxChar **argv_)
+{
+	if ( !wxAppConsole::Initialize(argc_, argv_) ) {
+		return false;
+	}
+
+#ifdef __UNIX__
+	wxString encName;
+#if wxUSE_INTL
+	// if a non default locale is set,
+	// assume that the user wants his
+        // filenames in this locale too
+        encName = wxLocale::GetSystemEncodingName().Upper();
+
+        // But don't consider ASCII in this case.
+	if ( !encName.empty() ) {
+		if ( encName == wxT("US-ASCII") ) {
+			// This means US-ASCII when returned
+			// from GetEncodingFromName().
+			encName.clear();
+		}
+        }
+#endif // wxUSE_INTL
+
+	// in this case, UTF-8 is used by default.
+        if ( encName.empty() ) {
+		encName = wxT("UTF-8");
+	}
+
+	static wxConvBrokenFileNames fileconv(encName);
+	wxConvFileName = &fileconv;
+#endif // __UNIX__
+
+	return true;
+}
 
 int CamuleDaemonApp::OnExit()
 {
